#!/bin/bash

# hadoop集群启动

if [ $# -eq 0 ]; then
	echo "Usage $0 start|stop"
fi
case $1 in

    "start"){
        echo " -------- 启动 集群 -------"
        echo " -------- 启动 hadoop集群 -------"
        ssh niit01 "source /etc/profile;start-dfs.sh"
        ssh niit03 "source /etc/profile;start-yarn.sh"
        ssh niit01 "source /etc/profile;mr-jobhistory-daemon.sh start historyserver"
    };;
    "stop"){
        echo " -------- 停止 集群 -------"
        echo " -------- 停止 hadoop集群 -------"
        ssh niit01 "source /etc/profile;mr-jobhistory-daemon.sh stop historyserver"
        ssh niit03 "source /etc/profile;stop-yarn.sh"
        ssh niit01 "source /etc/profile;stop-dfs.sh"
    };;
esac
